package wzc.design_pattern.behaviour.state;

/**
 * @Author 那和不是个啥
 * @Date 2025/7/20
 * @Description
 */

public class StatePatternDemo {
    public static void main(String[] args) {
        VendingMachine vendingMachine = new VendingMachine();

        // 测试没有投币的状态
        vendingMachine.pressButton();
        vendingMachine.insertCoin();
        vendingMachine.pressButton();
        vendingMachine.dispense();

        // 测试有投币的状态
        vendingMachine.insertCoin();
        vendingMachine.pressButton();
        vendingMachine.ejectCoin();

        // 测试售货中的状态
        vendingMachine.insertCoin();
        vendingMachine.pressButton();
    }
}
